
# 1. 定义函数 print_info()  , 打印提示信息.
def print_info():
    print('1. 添加学生信息')
    print('2. 删除学生信息')
    print('3. 修改学生信息')
    print('4. 查询单个学生信息')
    print('5. 查询所有的学生信息')
    print('6. 退出系统')

# 容器定义:
student_list = [{'id':'heima001', 'name':'刘亦菲', 'tel': '111'}, {'id':'heima002', 'name':'高圆圆', 'tel': '222'}]

def add_student():
    pass


def del_student():
    pass

# 修改学生信息.按照学号修改.
def update_student():
    # 1.录入学号.
    id = input('录入学号')
    #2.判断学号是否存在
    for stu_info in student_list:
        if stu_info['id'] == id:
            # 3.存在 去修改.
            name = input('录入姓名')
            tel = input('录入手机号')
            stu_info['name'] = name
            stu_info['tel'] = tel
            print('--------更新成功-----')
            break
        # else:
        #     pass # 啥也干不了.因为其它人还没比
    else:
        print('您录入的学号不存在')



def find_one_stu():
    pass


def find_all_stu():
    for stu in student_list:
        print(stu)


if __name__ == '__main__':
    while True:
        # 1.打印系统的功能
        print_info()

        # 2.用户选择操作
        choose = int(input('请录入您的选择:'))
        if choose == 1:
            print("添加")
            add_student()
        elif choose == 2:
            print('删除')
            del_student()
        elif choose == 3:
            print('更新')
            update_student()
        elif choose ==4:
            print('单个查询')
            find_one_stu()
        elif choose == 5:
            print('所有查询')
            find_all_stu()
        elif choose == 6:
            print('退出系统')
            break
        else:
            print('录入有误,请重新录入')